﻿using System.Diagnostics;

namespace follow_the_direction
{/// <summary>
/// 打出随机数
/// </summary>
    internal class Program
    {
        const int testNumber = 8;
        static void Main(string[] args)
        {
            //设定计时表
            Stopwatch sw = new Stopwatch();
            //设定随机数，97对应a,122对应z
            Random rnd = new Random();
            char guess = (char)rnd.Next(97, 122);
            char input;
            int faulseNumber = 0;
            Console.WriteLine("请输入您看到的字母");
            Console.WriteLine(guess);
            input = Console.ReadKey().KeyChar ;
            //开始计时
            sw.Start();
            for (int i = 0; i < testNumber - 1; i++)
            {
                if (guess != input)
                {
                    faulseNumber++;
                    Console.WriteLine("输错了哦，请再接再厉");
                }
                if (guess == input)
                {
                    Console.WriteLine("非常棒，请继续");
                }
                guess = (char)rnd.Next(97, 122);
                Console.WriteLine(guess);
                input = Console.ReadKey().KeyChar;
            }
            //停止计时
            sw.Stop();
            TimeSpan ts = sw.Elapsed;
            double timeConsuming = ts.TotalSeconds;
            Console.WriteLine($"耗时{timeConsuming}秒");
            Console.WriteLine($"输错次数为{faulseNumber}次");


        }
    }
}